package io.yuncheng.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import io.yuncheng.modules.sys.entity.SubAppAssessmentSplitConfigEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.yuncheng.modules.sys.service.SubAppAssessmentSplitConfigService;
import io.yuncheng.common.utils.PageUtils;
import io.yuncheng.common.utils.R;



/**
 * 方案配置
 *
 * @author jared
 * @email 15721509625@163.com
 * @date 2020-10-28 21:10:12
 */
@RestController
@RequestMapping("sys/subappassessmentsplitconfig")
public class SubAppAssessmentSplitConfigController {
    @Autowired
    private SubAppAssessmentSplitConfigService subAppAssessmentSplitConfigService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:subappassessmentsplitconfig:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = subAppAssessmentSplitConfigService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:subappassessmentsplitconfig:info")
    public R info(@PathVariable("id") Long id){
		SubAppAssessmentSplitConfigEntity subAppAssessmentSplitConfig = subAppAssessmentSplitConfigService.getById(id);

        return R.ok().put("subAppAssessmentSplitConfig", subAppAssessmentSplitConfig);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sys:subappassessmentsplitconfig:save")
    public R save(@RequestBody SubAppAssessmentSplitConfigEntity subAppAssessmentSplitConfig){
		subAppAssessmentSplitConfigService.save(subAppAssessmentSplitConfig);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sys:subappassessmentsplitconfig:update")
    public R update(@RequestBody SubAppAssessmentSplitConfigEntity subAppAssessmentSplitConfig){
		subAppAssessmentSplitConfigService.updateById(subAppAssessmentSplitConfig);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:subappassessmentsplitconfig:delete")
    public R delete(@RequestBody Long[] ids){
		subAppAssessmentSplitConfigService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
